let eo = require('../../common/lib/mobx').extendObservable;

let store = function () {
	eo(this, {
		box_state: false,
		box_style: "hide",
		msg: "",
		notice_type: "",
		done_text: "确定",
		cxl_text: "",
		done_fn: "",
		cxl_fn: "",
	});
	
	/* 
	show_type:
		”“：	普通通知，有底部”确定“按钮
		"waiting":	等待，没有底部按钮，需要程序关闭
	 */
	this.show_n = function(arg) {
		if(!arg.hasOwnProperty("msg")) {
			arg.msg = "请稍后"
		}
		if(!arg.hasOwnProperty("show_type")) {
			arg.show_type = ""
		}
		if(!arg.hasOwnProperty("done_text")) {
			arg.done_text = "确定"
		}
		if(!arg.hasOwnProperty("done_fn")) {
			arg.done_fn = ""
		}
		this.msg = arg.msg
		this.done_text = arg.done_text
		this.done_fn = arg.done_fn
		if (arg.show_type == "waiting") {
			this.notice_type = false
		}
		else {
			this.notice_type = true
		}
		this.box_style = "notice_body_show"
	}
	this.show = function (msg, show_type) {
		this.done_text = "确定"
		this.msg = msg
		if (show_type == "waiting") {
			this.notice_type = false
		}
		else {
			this.notice_type = true
		}
		this.box_style = "notice_body_show"
	}
	this.hide = function() {
		this.box_style = "notice_body_hide"
	}
}

module.exports = {
	store: new store
}